﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;

using DevExpress.XtraCharts;

using DrugsShopManagement;

namespace DrugsShopManagement
{
    public partial class XtraForm1 : DevExpress.XtraEditors.XtraForm
    {
        public XtraForm1()
        {
            InitializeComponent();
        }

        private void XtraForm1_Load(object sender, EventArgs e)
        {
            // TODO: 这行代码将数据加载到表“drugssale.drugsSales”中。您可以根据需要移动或删除它。
            this.drugsSalesTableAdapter.Fill(this.drugssale.drugsSales);
        }

        private void button1_Click(object sender, EventArgs e)
        {
            //series1.DataFilters.ClearAndAddRange(new DevExpress.XtraCharts.DataFilter[] {
            //new DevExpress.XtraCharts.DataFilter("drugsSalesTime", "System.DateTime", DevExpress.XtraCharts.DataFilterCondition.GreaterThan, new System.DateTime(2012, 6, 1, 0, 0, 0, 0))});
            //sideBySideBarSeriesLabel1.LineVisible = true;
            // Create new data filters and specify conditions for them.
            DataFilter dataFilter1 = new DataFilter("drugsSalesTime", "System.DateTime", DataFilterCondition.GreaterThanOrEqual, dateTimePicker1.Text.ToString());
            DataFilter dataFilter2 = new DataFilter("drugsSalesTime", "System.DateTime", DataFilterCondition.LessThanOrEqual, dateTimePicker2.Text.ToString());
            //DataFilter dataFilter2 = new DataFilter("CategoryID", "System.Int32", DataFilterCondition.Equal, 4);
            //DataFilter dataFilter3 = new DataFilter("CategoryID", "System.Int32", DataFilterCondition.Equal, 7);

            // Obtain the first series of the chart.
            Series series1 = chartControl1.Series[0];

            // Set the logical operator used to combine individual data filter conditions for this series.
            series1.DataFiltersConjunctionMode = ConjunctionTypes.And;

            // Remove all other filters.
            series1.DataFilters.Clear();

            // Add new filters to apply to the series data.
            series1.DataFilters.AddRange(new DataFilter[] { dataFilter1, dataFilter2});//, dataFilter3 });

        }
    }
}